/**
 * Created with IntelliJ IDEA
 * Description:
 * User: lenovo
 * Date: 2023 -04 -09
 * Time: 14:26
 */
public class Test {

    //合并两个有序链表，使得合并后仍然有序
    public static MyList.LinkList combinedLinkedList(
            MyList.LinkList headA, MyList.LinkList headB){
        MyList.LinkList newNode=new MyList.LinkList(-1);
        MyList.LinkList tmp=newNode;
        while(headA!=null&&headB!=null){
            if(headA.data< headB.data){
                tmp.next=headA;
                tmp=headA;
                headA=headA.next;
            }else{
                tmp.next=headB;
                tmp=headB;
                headB=headB.next;
            }
            if(headA==null){
                tmp.next=headB;
            }
            if(headB==null){
                tmp.next=headA;
            }
            if(headA==headB&&headA==null){
                return null;
            }
        }
        return newNode.next;
    }
    public static void main(String[] args) {
        MyList myList1=new MyList();
        myList1.addLast(3);
        myList1.addLast(9);
        myList1.addLast(25);
        myList1.addLast(1);
        myList1.addLast(12);
       /* MyList myList2=new MyList();
        myList2.addLast(4);
        myList2.addLast(11);
        myList2.addLast(18);
        myList2.addLast(36);
        myList2.addLast(125);
MyList.LinkList ret=combinedLinkedList(myList1.head,myList2.head);
myList1.display(ret);*/
        myList1.display();
        MyList.LinkList ret=myList1.partition(myList1.head,0);
        //MyList.LinkList ret2=myList1.partition(myList1.head,26);
        //MyList.LinkList ret3=myList1.partition(myList1.head,20);
        myList1.display(ret);
        //myList1.display(ret2);
        //myList1.display(ret3);

        System.out.println("==============");
/* myList.addLast(12);
        myList.addLast(23);
        myList.addLast(34);
        myList.addLast(23);
        myList.addLast(12);
        MyList.LinkList ret=myList.findLast_K(2);
        myList.display(ret);*/
      /*  int ret=myList.size();
        System.out.println(ret);
        myList.display();
        myList.addIndex(0,11);
        myList.display();
        myList.remove(23);
        myList.display();
        MyList.LinkList mid=myList.acquireIntermidNode();
        myList.display(mid);
        myList.reverseList();
        myList.display();*/
       /* Boolean palindrome=myList.palindrome();
        System.out.println(palindrome);*/
    }
}
